//
// Misc
// --------------------------------------------------

// Left menu2 =================================================================
.leftmenu2 {
  background-color: @xwiki-background-secondary-color;
  min-height: 30px;
  padding: 5px;
  border: 1px solid @input-border;
  border-radius: @border-radius-base @border-radius-base 0 0;
  border-bottom: 0;
  a {
    display: inline-block;
    img {
      margin: 4px;
    }
  }
}

// Suggests ===================================================================

div.suggestItems .hide-button {
  .text-muted-smaller;
}

// Labels =====================================================================

.language {
  &-translation,
  &-default {
    .label;
    .label-default;
    font-weight: 400;
  }
  &-default {
    font-style: italic;
  }
  &-current {
    .label-primary;
    font-weight: 700;
  }
}

// XDialogs ===================================================================

.xdialog-content {
  .buttonwrapper {
    input.button{
      margin: 2px;
    }
  }
}

// Comments ==================================================================

.commentcontent {
  overflow-x: auto;
}

// Messages ===================================================================

/* Used by: Toc, Box Macros */
.floatinginfobox {
  float: right;
  margin: @padding-base-vertical 0 @padding-base-vertical @padding-base-horizontal;
}

// AllDocs Tree ===============================================================

#XWEWrapper {
  margin: 2px 0 (30px + @input-height-base);
  .listGrid {
    border-width: 0;
    display: block !important; // Some browsers display this element distanced from the input
    & div:first-child {
      outline: none;
      top: 0 !important; // Some browsers have this element distanced with 8px from the main container
      left: 0 !important;
    }
    .gridBody {
      overflow: hidden; // IE11
    }
    table {
      width: auto;
    }
    tr > td:first-child { // IE11 - the first column is too large
      width: 0;
    }
    td {
      vertical-align: baseline;
    }
    .vScrollThumb td, .vScrollThumbOver td, #isc_4 td {
      vertical-align: middle; // Center grip in the middle of the scrollbar
    }
    #isc_4 { // Scrollbar area
      background-image: -ms-linear-gradient(left, #f5f5f5 0%, #e8e8e9 50%, #d7d9da 50%, #caccce 82%, #c0c2c4 100%); // IE10
      border: 1px solid #ababab; // IE10
      width: 15px !important; // IE10
      table {
        width: 100%; // IE10
      }
    }
    #isc_3 {
      width: 15px !important; // IE10
      height: auto !important; // IE10
    }
  }
}

#Treeview_Input {
  box-sizing: content-box;
  padding: 1px;
}


// Bugs =======================================================================

// FIX: Administration: Panel Wizard
.xwikitabbar {
  #panelEditorSteps& { // PROBLEM: Mapping and usage
    &>li {
      float: none;
      display: inline-block;
    }
    &:after {
      clear: none;
    }
  }
}

// FIX: Livetables
.xwiki-livetable {
  .pagesizeselect { // PROBLEM: General styling reset
    height: auto;
    width: auto;
  }
}

// FIX: Livetables, History Table
.xwiki-livetable,
.paginationFilter {
  .pagination { // PROBLEM: Usage of a class with meaning inside Bootstrap
    margin-top: 0;
    margin-bottom: 0;
  }
}

// FIX: History Table
.xwikidatatable .row:after, .xwikidatatable .row:before { // PROBLEM: Usage of a class with meaning inside Bootstrap
  display: none;
}

// FIX: User Profile labels
.user-page-pane .label { // PROBLEM: Usage of a class with meaning inside Bootstrap
  display: inherit;
  font-size: inherit;
  padding: inherit;
  text-align: left;
  white-space: normal;
}

// FIX: Blog Post footer
.entry-footer address { // PROBLEM: Usage of a class with meaning inside Bootstrap
  display: inline;
  margin: 0;
}

// FIX: Date Picker
.skin-flamingo .calendar_date_select {
  width: auto;
  div.cds_header select.month {
    width: 9em;
  }
  div.cds_header select.year {
    width: 7em;
  }
  td {
    padding: 0;
  }
}

// FIX: Auto-save
.skin-flamingo #autosaveControl input.autosave-frequency {
  width: 3em;
}

// FIX: user profile
.skin-flamingo {
  .user-menu-profile:before, .user-menu-preferences:before, .user-menu-watchlist:before, .user-menu-network:before, .user-menu-wikis:before, .user-menu-dashboard:before {
    display: none;
  }
}

// FIX: file upload
.skin-flamingo {
  .upload-status-container {
    .buttonwrapper a, .upload-canceled-label {
      .btn-xs();
    }
  }
}

// FIX: login
#loginForm {
  .panel {
    max-width: @loginFormMaxWidth;
    margin: auto;
    text-align: left;
  }
  .xAdditional {
    &.recoverPassword {
      text-align: right;
    }
    flex-grow: 1;
    font-size: .8em;
    font-weight: normal;
    margin-top: .3em;
  }
  .submitSection {
    display: flex;
    flex-flow: row wrap;
    gap: 1em;
    /* Same as `.xform dl dt` */
    margin-top: floor(@font-size-base * 1.4);
  }
}

.resetpasswordpanel, .forgotusernamepanel {
  max-width: @loginFormMaxWidth;
  margin: auto;
  text-align: left;

  .resetpasswordlinks, .forgotusernamelinks {
    margin-top: 1em;
  }
}

// FIX: User profile
.skin-flamingo {
  #user-menu-col {
    width: 13em;
    @media (max-width: @screen-xs-min) {
      float: none;
      margin: auto;
    }
  }

  #user-page-content {
    @media (max-width: @screen-xs-min) {
      margin-left: 0;
    }
  }
}

// FIX: Syntax help page (XWIKI-10675)
.syntax-menu:extend(.admin-menu all) {}
#syntax-page-content:extend(#admin-page-content all) {}
.skin-flamingo {
  #syntax-page-content {
    margin-left: 0;
  }
}

// FIX: do no use .hidden (see: XWIKI-10827) but must be invisible
#docextraanchors {
  .invisible();
  font-size: 0px;
}


// Fix: Glyphicon: the space icon has a bad width
// (see: http://jira.xwiki.org/browse/XWIKI-10835)
.glyphicon-folder-open:before {
  margin-right: 3px;
}

// Export ---------------------------------------------------------------------
.export-tree {
  border: 1px solid @panel-inner-border;
  padding: @panel-body-padding;

  .jstree-anchor {
    // Leave some space between the nodes in order to improve the selection display.
    margin: 1px 0;
  }
}

// Limit the tree height when displayed inside a modal.
.modal-body .export-tree {
  max-height: 400px;
  overflow: auto;
}

.export-tree-filter {
  .flat-buttons();

  ul.dropdown-menu {
    // Increase the minimum width because the hint is displayed on multiple lines.
    min-width: 320px;
    // Fixes list padding overwritten by the panel styles.
    padding: (@line-height-computed / 4) 0;

    li .xHint {
      // The hint can be displayed on multiple lines.
      white-space: normal;
    }
  }
}

.export-tree-legend {
  margin: (@line-height-computed / 4) 0 0;
}
dl.export-tree-legend dt,
dl.export-tree-legend dd {
  display: inline;
  font-weight: normal;
  margin: 0;
}
dl.export-tree-legend dt + dd {
  margin-right: 1em;
}

.export-tree-container + .export-buttons {
  margin-top: 1em;
}

// Reduce the font size when inside a modal.
.modal-body .export-tree-filter .dropdown-toggle,
.modal-body .export-tree-action {
  font-size: smaller;
}

#moreExportOptionsToggle {
  color: @text-muted;
  display: inline-block;
  margin-bottom: (@line-height-computed / 2);
}
#moreExportOptionsToggle .more,
#moreExportOptionsToggle.collapsed .less {
  display: none;
}
#moreExportOptionsToggle.collapsed .more {
  display: inline;
}
#moreExportOptionsToggle .more > span,
#moreExportOptionsToggle .less > span {
  margin-left: .3em;
}

// Loading --------------------------------------------------------------------
.loading {
  background: transparent url(@xwiki-icon-spinner) no-repeat center;
  min-height: @xwiki-icon-spinner-height;
}

// Importer -------------------------------------------------------------------
#package .checkbox {
  margin: 0 -2px 0 0;
}

// Viewer = changes -----------------------------------------------------------
#changes-info {
  margin-top: (@grid-gutter-width / 2);
  margin-bottom: (@grid-gutter-width / 2);
  padding-top: (@grid-gutter-width / 2);
  padding-bottom: (@grid-gutter-width / 2);
  position: relative;
}

#changes-info-boxes {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: 5vw;
  row-gap: 1vh;
}

.changes-info-box {
  flex: 1;
  padding: (@main-padding / 4) (@main-padding / 2);
  background-color: @xwiki-background-secondary-color;
  border-radius: @border-radius-large;
  text-align: center;
}

.changes-info-title {
  .h3;
  margin-top: 0;
}

.changes-version {
  white-space: nowrap;
}

.changes-arrow {
  font-size: inherit;
}

.changes-arrow, .changes-arrow-left, .changes-arrow-right {
  &, &:hover, &:active, &:visited, &:focus {
    vertical-align: baseline;
    font-weight: 700;
  }
}

#changes-arrows-box {
  font-size: 1.5em;
  flex-basis: 100%;
  display: flex;
  justify-content: space-between;
}

/* Make sure the right change arrow stays on the right even when the left one is not here. */
#changes-arrows-box:not(:has(> .changes-arrow-left)) {
  justify-content: right;
}

.changes-body > .changes-body-header {
  border-bottom: @border-width solid @xwiki-border-color;
  margin-bottom: (@grid-gutter-width / 2);
  padding-bottom: (@grid-gutter-width / 4);
}

.changes-body .changes-actions {
  color: @text-muted;
  display: none;
  font-size: smaller;
  text-align: right;
}
.changes-body .changes-actions.active {
  display: block;
}

.html-diff-context-toggle {
  color: inherit;
}
a.html-diff-context-toggle {
  display: inline-block;
  padding: @nav-link-padding;
  text-decoration: none;
}

.html-diff-context-toggle-show .html-diff-context-hide,
.html-diff-context-toggle-hide .html-diff-context-show {
  display: none;
}

// Panels Layout --------------------------------------------------------------
/* Content Panels are defined in macros.vm in #displayPanelLayout and used in applications like Statistics */

.panellayoutcol {
  .panellayoutcontainer-1col &, .panellayoutcontainer-2col &, .panellayoutcontainer-3col &, .panellayoutcontainer-4col & {
    .make-xs-column(12);
    & .xwikipanelcontents {
      overflow: auto;
    }
  }
  .panellayoutcontainer-2col & {
    .make-sm-column(6);
  }
  .panellayoutcontainer-3col & {
    .make-sm-column(4);
  }
  .panellayoutcontainer-4col & {
    .make-sm-column(3);
  }
}

.panellayoutcontainer-1col, .panellayoutcontainer-2col, .panellayoutcontainer-3col, .panellayoutcontainer-4col {
  .clearfix();
}

// Delete Job -----------------------------------------------------------------
// Warning message when pages belong to extensions
.deleteWarningExtensions {
  margin-top: @line-height-computed;

  // Do not display checkbox on pagination nodes in the tree:
  .jstree-xwiki .paginationNode .jstree-checkbox {
    display: none;
  }
}
.deleteWarningButtons {
  margin: 0;
  padding: (@line-height-computed / 2);
}

// Tree Webjar (XWIKI-15089) ---------------------------------------------------
.skin-flamingo .jstree-xwiki .jstree-clicked {
  background-color: @nav-link-hover-bg; /* $theme.highlightColor */
  border-radius: @border-radius-small;
}

.skin-flamingo .jstree-xwiki .jstree-anchor:hover {
  border-radius: @border-radius-small;
}

.previewdiff-diff-options {
  text-align: center;

  .label {
    color: @text-color;
  }
}

// Select
.xwiki-select-option-highlighted {
  background-color: @breadcrumb-bg;
}

.xwiki-select-option-selected {
  background-color: @nav-link-hover-bg;
}
